//
//  QRCodeCreateViewController.swift
//  WeiboSwift
//
//  Created by xiaokui wu on 9/12/16.
//  Copyright © 2016 wxk. All rights reserved.
//

import UIKit

class QRCodeCreateViewController: UIViewController {

    @IBOutlet weak var codeImageView: UIImageView!
    override func viewDidLoad() {
        super.viewDidLoad()

        // 滤镜
        let filter = CIFilter(name: "CIQRCodeGenerator")
        
        // 还原默认属性
        filter?.setDefaults()
        
        filter?.setValue("www.baidu.com".dataUsingEncoding(NSUTF8StringEncoding), forKeyPath: "inputMessage")
        
        if let ciImage = filter?.outputImage{
            let image = UIImage().imageWithNonInterpolatedFromCIImage(ciImage, size: 500)
            codeImageView.image = image
        }
        
        
    }

}
